package fenetre;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;

public class CL_confirm extends JFrame implements MouseListener , ActionListener{
	
	private JLabel lblEtesVousSur;
	private JButton btnValider;
	private JButton btnAnnuler;
	private GroupLayout groupLayout;
	
	public CL_confirm() {
		
		lblEtesVousSur = new JLabel("Etes vous sur de vouloir supprimer cet album ?");
		btnValider = new JButton("Valider");
		btnValider.addActionListener(this);
		btnValider.addActionListener(new ActionListener() { 
				public void actionPerformed(ActionEvent e) { }	
			});
		
		btnAnnuler = new JButton("Annuler");
		btnAnnuler.addActionListener(this);
		btnAnnuler.addActionListener(new ActionListener() { 
				public void actionPerformed(ActionEvent e) { }	
			});
		
		
		groupLayout = new GroupLayout(getContentPane());
		
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(lblEtesVousSur)
						.addGroup(groupLayout.createSequentialGroup()
							.addComponent(btnValider)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(btnAnnuler)))
					.addContainerGap(121, Short.MAX_VALUE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addComponent(lblEtesVousSur)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(btnValider)
						.addComponent(btnAnnuler))
					.addContainerGap(79, Short.MAX_VALUE))
		);
		getContentPane().setLayout(groupLayout);
	}


			
			
			
			

	@Override
	public void actionPerformed(ActionEvent e) {
		String nomBouton = e.getActionCommand();

		if (nomBouton == "Valider"){
			System.out.println("test : valider");
		}
		else if (nomBouton == "Annuler"){
			System.out.println("test : annuler");
		}
	}

	@Override
	public void mouseClicked(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

}
